// productDetail.js
var network = require("../../utils/network.js");
var WxParse = require('../../wxParse/wxParse.js'); 
Page({

  /**
   * 页面的初始数据
   */
  data: {
    
  },

  productDetail: function () {
    let that = this;
    let URL = network.server() + 'goods/info-api';
    let Params = { model_id: that.data.model_id };
    let Method = 'GET';
    let Message = '';
    network.requestLoading(URL, Params, Method, Message, function (res) {
      console.log('商品详情---', res)
      if (res.code == 0) {
        let goods_image = res.data.goods_image;
        let article = res.data.goods_desc;
        that.setData({
          goods_image: goods_image,
          content: WxParse.wxParse('article', 'html', article, that, 5)
        })
      }
    }, function () {
      // wx.showToast({
      //   title: '加载数据失败',
      // })
    })
  },

  onLoad: function (options){
    var title = options.goods_title;
    var model_id = options.model_id;
    //console.log(model_id)
    wx.setNavigationBarTitle({
      title: title,
    })
    this.setData({
      model_id: model_id
    })
    this.productDetail();
  }
})